#ifndef APTABLEMODEL_H
#define APTABLEMODEL_H

#include <QAbstractTableModel>
#include <housingdbms.h>
#include "dbmscontainer.h"




class ApTableModel : public QAbstractTableModel, public DbmsContainer
{
    Q_OBJECT

    QVariantList    mqvl_ap_indexes;
    QVariant    mqv_active_h_index;

public:
    explicit ApTableModel(QObject *parent = 0);
    void load_data(const QVariantList &qvl_h_indexes);
    int rowCount(const QModelIndex &parent) const;
    int columnCount(const QModelIndex &parent) const;
    QVariant data(const QModelIndex &index, int role) const;
    QVariant headerData(int section, Qt::Orientation orientation, int role) const;
    QModelIndex get_model_index_by_h_index(const QVariant &qv_h_index);
    QVariant    get_ap_db_index(const QModelIndex &index);
    SLEE_HDB_REC get_ap_data(const QModelIndex &index);
    void update_data(const QModelIndex &index, const SLEE_HDB_REC &qh_data);
    QModelIndex get_model_index_by_ap_index(const QVariant &qv_ap_index);
    int get_fld_by_mindex(const QModelIndex &index);
    inline void set_active_h_index(const QVariant &qv_h_index) {mqv_active_h_index = qv_h_index; }

signals:

public slots:

};

#endif // APTABLEMODEL_H
